﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using VistaOnlineR1._1.Reportes;
using Modelo.Sistema.Venta;
using VistaOnlineR1._1.Models;
using DevExpress.XtraCharts;
using VistaOnlineR1._1.Helpers;

namespace VistaOnlineR1._1.Controllers
{
    public class HomeController : Controller
    {
        //
        // GET: /Home/

        public ActionResult Index()
        {        
            return View();
        }        
        public ActionResult PrintingAndExporting()
        {
            return View("PrintingAndExporting", MicrosoftAnnualRevenueProvider.GetMicrosoftAnnualRevenue());
        }
        public ActionResult PrintingAndExportingPartial()
        {
            return PartialView("PrintingAndExportingPartial", MicrosoftAnnualRevenueProvider.GetMicrosoftAnnualRevenue());
        }       

        public ActionResult RerpotePedidos()
        {
            XtraReport3 report = new XtraReport3();
            CatalogoPedidos c = new CatalogoPedidos();

            List<PedidoReporte> pe = (from p in c.ListarPedidos()
                        select new PedidoReporte
                        {
                            Cliente = p.Cliente.Nombre,
                            Total = p.Total
                        }).ToList();


            report.DataSource = pe;

            ViewData["Report"] = report;
            
            return View();
        }        

    }

    
}
